<?php

namespace Biz\model\settlement;

use Doraemon\pockets\datebase\BaseDbModel;


class BaseAccountTransaction extends BaseDbModel
{


    //账户类型
    const ACCOUNT_TYPE_HHZ_COST = 1;//好好住成本账户
    const ACCOUNT_TYPE_HHZ_INCOME = 2;//好好住收入账户
    const ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT = 3;//商家待结算账户
    const ACCOUNT_TYPE_SHOP_SETTLEMENT = 4;//商家结算账户
    const ACCOUNT_TYPE_SHOP_DEPOSIT = 5;//商家保证金账户

    //交易类型
    const TRANSACTION_TYPE_USER_PAYMENT = 101;//用户付款
    const TRANSACTION_TYPE_ORDER_REFUND = 102;//订单退款
    const TRANSACTION_TYPE_INTEGRAL_PAYMENT = 201;//积分支付
    const TRANSACTION_TYPE_BACK_INTEGRAL = 202;//退款扣积分补贴(退款返积分)
    const TRANSACTION_TYPE_HHZ_COUPON_PAYMENT = 203;//平台优惠券支付
    const TRANSACTION_TYPE_HHZ_BACK_COUPON = 204;//退款扣优惠券补贴(退款返平台券)
    const TRANSACTION_TYPE_HHZ_ACTIVITY_ALLOWANCE_PAYMENT = 205;//(提交订单)平台活动补贴
    const TRANSACTION_TYPE_HHZ_BACK_ACTIVITY_ALLOWANCE = 206;//退款扣平台活动补贴（退款返平台活动补贴）
    const TRANSACTION_TYPE_RED_PACKET_PAYMENT = 207;//现金红包支付
    const TRANSACTION_TYPE_BACK_RED_PACKET = 208;//退款扣红包补贴
    const TRANSACTION_TYPE_ORDER_SETTLEMENT_RMB = 301;//订单结算-现金
    const TRANSACTION_TYPE_ORDER_SETTLEMENT_INTEGRAL = 302;//订单结算-积分
    const TRANSACTION_TYPE_ORDER_SETTLEMENT_COUPON = 303;//订单结算-平台券
    const TRANSACTION_TYPE_ORDER_SETTLEMENT_ACTIVITY_ALLOWANCE = 304;//订单结算-平台活动补贴
    const TRANSACTION_TYPE_ORDER_SETTLEMENT_RED_PACKET = 305;//订单结算-现金红包
    const TRANSACTION_TYPE_DEDUCT_COMMISSION = 307;//结算扣佣金
    const TRANSACTION_TYPE_BACK_COMMISSION = 308;//退款返佣金
    const TRANSACTION_TYPE_COMMISSION_ADJUSTMENT = 601;//运营调整-调整佣金 (好好住收入账户和商家结算账户之间流转)
    const TRANSACTION_TYPE_DEPOSIT_ADD_GOODS_AMOUNT = 602;//保证金补货款
    const TRANSACTION_TYPE_HHZ_ALLOWANCE_ADJUSTMENT = 603;//运营调整-调整平台补贴(好好住成本账户和商家结算账户之间流转)
    const TRANSACTION_TYPE_ADD_DEPOSIT = 801;//商家交保
    const TRANSACTION_TYPE_CLOSE_BACK_DEPOSIT = 802;//关店退保
    const TRANSACTION_TYPE_WITHDRAWAL = 901;//提现

    //操作类型
    const OPERATE_TYPE_SYS = 0;//系统操作
    const OPERATE_TYPE_ADMIN = 1;//管理员操作
    const OPERATE_TYPE_SHOP = 2;//商家操作
    const OPERATE_TYPE_USER = 3;//买家操作

    const STATUS_NORMAL = 0;//正常状态
    const STATUS_DEL = 9;//删除状态

    public static $transactionTypeDesc = [
        self::TRANSACTION_TYPE_USER_PAYMENT => '用户付款',
        self::TRANSACTION_TYPE_ORDER_REFUND => '订单退款',
        self::TRANSACTION_TYPE_INTEGRAL_PAYMENT => '积分支付',
        self::TRANSACTION_TYPE_BACK_INTEGRAL => '退款扣积分补贴',
        self::TRANSACTION_TYPE_HHZ_COUPON_PAYMENT => '平台优惠券支付',
        self::TRANSACTION_TYPE_HHZ_BACK_COUPON => '退款扣优惠券补贴',
        self::TRANSACTION_TYPE_HHZ_ACTIVITY_ALLOWANCE_PAYMENT => '平台活动补贴',
        self::TRANSACTION_TYPE_HHZ_BACK_ACTIVITY_ALLOWANCE => '退款扣平台活动补贴',
        self::TRANSACTION_TYPE_RED_PACKET_PAYMENT => '现金红包支付',
        self::TRANSACTION_TYPE_BACK_RED_PACKET => '退款扣红包补贴',
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_RMB => '订单结算-现金',
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_INTEGRAL => '订单结算-积分',
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_COUPON => '订单结算-平台券',
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_ACTIVITY_ALLOWANCE => '订单结算-平台活动补贴',
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_RED_PACKET => '订单结算-现金红包',
        self::TRANSACTION_TYPE_DEDUCT_COMMISSION => '结算扣佣金',
        self::TRANSACTION_TYPE_BACK_COMMISSION => '退款返佣金',
        self::TRANSACTION_TYPE_COMMISSION_ADJUSTMENT => '调整佣金',
        self::TRANSACTION_TYPE_DEPOSIT_ADD_GOODS_AMOUNT => '保证金补货款',
        self::TRANSACTION_TYPE_HHZ_ALLOWANCE_ADJUSTMENT => '调整平台补贴',
        self::TRANSACTION_TYPE_ADD_DEPOSIT => '商家交保',
        self::TRANSACTION_TYPE_CLOSE_BACK_DEPOSIT => '关店退保',
        self::TRANSACTION_TYPE_WITHDRAWAL => '提现',
    ];

    public static $actionClassToAccountType = [
        HhzCost::class => self::ACCOUNT_TYPE_HHZ_COST,
        HhzInCome::class => self::ACCOUNT_TYPE_HHZ_INCOME,
        WillSettlement::class => self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT,
        Settlement::class => self::ACCOUNT_TYPE_SHOP_SETTLEMENT,

    ];

    public static $operateTypeDesc = [
        self::OPERATE_TYPE_SYS => 'system',
        self::OPERATE_TYPE_ADMIN => '好好住',
        self::OPERATE_TYPE_SHOP => '商家',
        self::OPERATE_TYPE_USER => '买家'
    ];

    public static $transactionLogDesc = [

        //订单提交成功
        self::TRANSACTION_TYPE_INTEGRAL_PAYMENT => [
            self::ACCOUNT_TYPE_HHZ_COST => '订单%s用户%s积分支付',
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s积分支付',
        ],
        self::TRANSACTION_TYPE_HHZ_COUPON_PAYMENT => [
            self::ACCOUNT_TYPE_HHZ_COST => '订单%s用户%s平台优惠券支付',
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s平台优惠券支付',
        ],
        self::TRANSACTION_TYPE_HHZ_ACTIVITY_ALLOWANCE_PAYMENT => [
            self::ACCOUNT_TYPE_HHZ_COST => '订单%s用户%s平台活动补贴',
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s平台活动补贴',
        ],
        self::TRANSACTION_TYPE_RED_PACKET_PAYMENT => [
            self::ACCOUNT_TYPE_HHZ_COST => '订单%s用户%s现金红包支付',
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s现金红包支付',
        ],

        //订单支付成功
        self::TRANSACTION_TYPE_USER_PAYMENT => [
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s付款',
        ],

        //订单确认收货
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_RMB => [
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s结算货款',
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s结算货款',
        ],
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_INTEGRAL => [
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s积分支付',
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s用户%s积分支付',
        ],
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_COUPON => [
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s平台券支付',
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s用户%s平台券支付',
        ],
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_ACTIVITY_ALLOWANCE => [
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s平台活动补贴',
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s用户%s平台活动补贴',
        ],
        self::TRANSACTION_TYPE_ORDER_SETTLEMENT_RED_PACKET => [
            self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s用户%s现金红包支付',
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s用户%s现金红包支付',
        ],
        self::TRANSACTION_TYPE_DEDUCT_COMMISSION => [
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s扣佣金',
            self::ACCOUNT_TYPE_HHZ_INCOME => '订单%s佣金收入',
        ],

        //管理后台提现
        self::TRANSACTION_TYPE_WITHDRAWAL => [
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '提现￥%s元',
        ],

        //订单退款成功
        //1:确认收货前退款 2:确认收货后退款
        self::TRANSACTION_TYPE_ORDER_REFUND => [
            1 => [
                self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s商品%s退款',
            ],
            2 => [
                self::ACCOUNT_TYPE_HHZ_INCOME => '订单%s商品%s退款返还佣金',
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s商品%s退款返还佣金',
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s商品%s退款',
            ],
        ],
        self::TRANSACTION_TYPE_BACK_INTEGRAL => [
            1 => [
                self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s商品%s退款返积分',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款返积分',
            ],
            2 => [
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s商品%s退款返积分',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款返积分',
            ],
        ],
        self::TRANSACTION_TYPE_HHZ_BACK_COUPON => [
            1 => [
                self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s商品%s退款返平台优惠券',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款返平台优惠券',
            ],
            2 => [
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s商品%s退款返平台券',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款返平台券',
            ]
        ],
        self::TRANSACTION_TYPE_HHZ_BACK_ACTIVITY_ALLOWANCE => [
            1 => [
                self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s商品%s退款扣平台活动补贴',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款扣平台活动补贴',
            ],
            2 => [
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s商品%s退款扣平台活动补贴',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款扣平台活动补贴',
            ]
        ],
        self::TRANSACTION_TYPE_BACK_RED_PACKET => [
            1 => [
                self::ACCOUNT_TYPE_SHOP_WILL_SETTLEMENT => '订单%s商品%s退款返现金红包',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款返现金红包',
            ],
            2 => [
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '订单%s商品%s退款返现金红包',
                self::ACCOUNT_TYPE_HHZ_COST => '订单%s商品%s退款返现金红包',
            ]
        ],

        //运营调整 调整佣金 1:补款 2：扣款
        self::TRANSACTION_TYPE_COMMISSION_ADJUSTMENT => [
            1 => [
                self::ACCOUNT_TYPE_HHZ_INCOME => '调整佣金补款',
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '调整佣金补款',
            ],
            2 => [
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '调整佣金扣款',
                self::ACCOUNT_TYPE_HHZ_INCOME => '调整佣金扣款',
            ],
        ],

        //调整平台补贴1:补款 2：扣款
        self::TRANSACTION_TYPE_HHZ_ALLOWANCE_ADJUSTMENT => [
            1 => [
                self::ACCOUNT_TYPE_HHZ_COST => '调整平台补贴补款',
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '调整平台补贴补款',
            ],
            2 => [
                self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '调整平台补贴扣款',
                self::ACCOUNT_TYPE_HHZ_COST => '调整平台补贴扣款',
            ],
        ],


        //保证金补货款
        self::TRANSACTION_TYPE_DEPOSIT_ADD_GOODS_AMOUNT => [
            self::ACCOUNT_TYPE_SHOP_DEPOSIT => '保证金补货款',
            self::ACCOUNT_TYPE_SHOP_SETTLEMENT => '保证金补货款',
        ],
        //商家交保
        self::TRANSACTION_TYPE_ADD_DEPOSIT => [
            self::ACCOUNT_TYPE_SHOP_DEPOSIT => '商家交保',
        ],
        //关店退保
        self::TRANSACTION_TYPE_CLOSE_BACK_DEPOSIT => [
            self::ACCOUNT_TYPE_SHOP_DEPOSIT => '关店退保'
        ]
    ];
}
